from django.db import models
# from django.contrib.auth.models import AbstractUser


class Users(models.Model):
    """
    用户信息
    Args:
        AbstractUser (_type_): _description_
    """
    account = models.CharField(verbose_name='账号', max_length=32, default='', blank=False)
    password = models.CharField(verbose_name='密码', max_length=128)
    image = models.ImageField(verbose_name='头像', upload_to='avatar/%Y/%m', default='avatar/default.png', blank=True)
    name = models.CharField(verbose_name='姓名', max_length=32, default='', blank=False)
    enName = models.CharField(verbose_name='英文姓名', max_length=32, default='', blank=False)
    sno = models.CharField(verbose_name='员工编号', max_length=32, default='', blank=False)
    mobile = models.CharField(verbose_name='手机号码', max_length=11, null=True, blank=True, default=None)
    sex = models.CharField(verbose_name='性别', max_length=32, default='', blank=False)
    position = models.CharField(verbose_name='职务', max_length=32, default='', blank=False)
    leader = models.CharField(verbose_name='主管', max_length=32, default='', blank=False)
    # roles = models.ManyToManyField('system.Roles', verbose_name='角色', db_table='user_roles', blank=True)
    # dept = models.ForeignKey('system.Departments', verbose_name='部门', null=True, blank=True, on_delete=models.SET_NULL)
    status = models.CharField(verbose_name='账号状态(0正常 1停用)', default='0', blank=True)

    class Meta:
        managed = True
        app_label = 'Users'
        db_table = 'Sys_Users'

    def __str__(self):
        return '%s' % (self.name)
